package web.servlet;

import domain.Account;
import service.AccountService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class RegisterFormServlet extends HttpServlet {
    private static final String NEW_ACCOUNT_FORM = "/WEB-INF/jsp/account/register.jsp";

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        HttpSession session = req.getSession();
        session.setAttribute("message2","");

        //默认收货地址什么的表格信息显示的账户为j2ee
        AccountService accountService = new AccountService();
        Account account = accountService.getAccount("j2ee");
        session.setAttribute("account",account);

        req.getRequestDispatcher(NEW_ACCOUNT_FORM).forward(req, resp);
    }
}
